home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2001 December / pcwk12201b.iso / Wersje pelne i specjalne / Winamp 2.77 i 3.0beta / wasabi-sdk_beta1.exe / docs / Window Creation Services Retrofit.txt < prev   
Encoding:
Text File  |  2001-10-08  |  3.0 KB  |  79 lines

  1.  
  2. Please retrofit your componentry to be compliant with the new Window Creation
  3. Services by completing the steps outlined in this document.
  4.  
  5. This document references code found in:
  6.         common/SimpleWndCreate.h
  7.         exampleb/ExampleB.h
  8.         exampleb/ExampleB.cpp
  9.  
  10. Having these three files open and available to follow along with this document
  11. will increase your standard of living, significantly, for at least 3 hours
  12. after reading.  You also might see an increase in your basal metabolic rate if
  13. you realize that I tagged the "Start" and "End" sections of code to be added
  14. with "// WCS: " so you can easily find it in ExampleB.h and ExampleB.cpp
  15.  
  16. Honest.
  17.  
  18. Or Something.
  19.  
  20. 1)  Add the static methods block from SampleWindowCreationObj (which is found
  21. in SimpleWndCreate.h) to your component class definition, as done in ExampleB.h
  22.  
  23.  
  24.  
  25. 2)    Create the functionality for the "static WACNAME & Main()" method by
  26. creating the static pointer to your component class, filling it in the
  27. constructor to your component class, and optionally asserting that you're only
  28. ever going to instantiate a single copy of your component (which is a good idea
  29. when you're playing with GUIDs, eh?)
  30.  
  31.  
  32.  
  33. 3)    Add the non-static member functions called by the static block.  The 
  34. functions you will likely need to add are:
  35.     int destroyWindow(RootWnd * deadWnd);
  36.     ThingerBitmapInfo getThingerBitmapInfo();
  37. Do whatever you need to do in them.  Please visit ExampleB.cpp to see how I use
  38. them.
  39.  
  40.  
  41.  
  42. 4)    Instantiate the WCS template as a data member of your component module,
  43. using your component class as the ThingerWndCreate parameter (ExampleB.cpp):
  44.  
  45.     static waServiceT< svc_windowCreate,
  46.         ThingerWndCreateSvc< WACNAME > > myWndCreateSvc;
  47.  
  48. In order to instantiate that template, you will need to include these files:
  49.     #include "../studio/services/servicei.h"
  50.     #include "../studio/services/svc_wndcreate.h"
  51.     #include "../common/SimpleWndCreate.h"
  52.  
  53.  
  54.  
  55. 5)    Add the following method (as seen in ExampleB.cpp):
  56.     void onRegisterServices() {
  57.       // ***  Register our window creation service here.
  58.       //      If we don't do this, we don't get a window.
  59.       api->service_register(&myWndCreateSvc); 
  60.       api->register_autoPopupGUID(getGUID(), getName());
  61.     }
  62.  
  63.  
  64.  
  65. 6)    Obviously, if we're registering a service, we should probably deregister
  66. our service as well.  Do so in your onDestroy() method (as in ExampleB.cpp) :
  67.     void onDestroy() {
  68.       // ***  Deregister our window creation service here.
  69.       //      If we don't do this, we get a memory leak.
  70.       api->service_deregister(&ExampleB_WndCreateSvc);
  71.       // *** Be sure to delete all your windows etc HERE, not in the destructor,
  72.       //     because the API pointer might be invalid in the destructor
  73.       delete wnd; wnd = NULL;
  74.       WACPARENT::onDestroy();
  75.     }
  76.  
  77. 7)    There's also been a change to no longer allow support for BMP data as studio
  78. data.  You will need to alter your source graphics for your resource file to use
  79. PNG data.  Please see ExampleB.rc for how to do this.